package com.mimosa.common.system.permission;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.mimosa.common.entity.BaseEntity;
import com.mimosa.util.config.YesNoType;

@Entity
@Table(name = "T_Permission")
public class TPermission extends BaseEntity {
	public static final String PROPERTY_ITEM_ID = "itemId";
	public static final String PROPERTY_ITEM_Type = "itemType";
	public static final String PROPERTY_ROLE_OR_USER_ID = "roleOrUserId";
	public static final String PROPERTY_USER_FLAG = "userFlag";
	public static final String PROPERTY_STATE = "state";

	@Column(length = 32, nullable = false)
	private String roleOrUserId; // 角色id
	@Column(length = 1, nullable = false)
	private String userFlag = YesNoType.N.name(); // 是否用户
	@Column(length = 16, nullable = false)
	private String itemType; // 权限类型
	@Column(length = 32, nullable = false)
	private String itemId; // 权限标示（32）

	public TPermission() {
	}

	public TPermission(String roleOrUserId, String itemId, String itemType) {
		this.setRoleOrUserId(roleOrUserId);
		this.setItemId(itemId);
		this.setItemType(itemType);
	}

	public String getRoleOrUserId() {
		return roleOrUserId;
	}

	public void setRoleOrUserId(String roleOrUserId) {
		this.roleOrUserId = roleOrUserId;
	}

	public String getUserFlag() {
		return userFlag;
	}

	public void setUserFlag(String userFlag) {
		this.userFlag = userFlag;
	}

	public String getItemType() {
		return itemType;
	}

	public void setItemType(String itemType) {
		this.itemType = itemType;
	}

	public String getItemId() {
		return itemId;
	}

	public void setItemId(String itemId) {
		this.itemId = itemId;
	}
}